package com.apes.scm.masterdata.product.service;

import com.apes.framework.api.DomainService;
import com.apes.framework.plugin.esb.api.SimpleRequest;
import com.apes.scm.masterdata.product.model.ConsumablesKit;
import com.apes.scm.masterdata.product.repository.ConsumablesKitRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @ClassName ConsumablesKitService
 * @Description TODO
 * @Author pengyb
 * @Date 2019/12/24 15:30
 * @Version 1.0
 **/
@Service("consumablesKitService")
public class ConsumablesKitService extends DomainService {
    ConsumablesKitRepository consumablesKitRepository;

    @Autowired
    private void setConsumablesKitRepository(ConsumablesKitRepository consumablesKitRepository) {
        this.consumablesKitRepository = consumablesKitRepository;
    }

    public ConsumablesKit save(SimpleRequest request) {
        ConsumablesKit kit = request.getO(ConsumablesKit.class);
        return consumablesKitRepository.saveAndFlush(kit);
    }

    public String delete(SimpleRequest request) {
        ConsumablesKit kit = request.getO(ConsumablesKit.class);
        consumablesKitRepository.delete(kit.getId());
        return "删除成功";
    }
}
